/**
 * Created by hhuai on 2/13/15.
 */


var StartLayer = cc.Layer.extend({
    ctor:function () {
        this._super();

        var size = cc.winSize;

        var bgSprite = new cc.Sprite(res.BackGround_png);
        bgSprite.attr({
            x: size.width / 2,
            y: size.height / 2
        });
        this.addChild(bgSprite, 0);


        //menu
        //这里对于js的参数作一下解释
        var startMenuItem = new cc.MenuItemImage(
            res.Start_N_png,
            res.Start_S_png,
            function () {
                cc.director.runScene(new PlayScene());
            }, this
        );
        startMenuItem.attr({
            x: size.width/2,
            y: size.height/2
        });

        var menu = new cc.Menu(startMenuItem);
        menu.x = menu.y = 0;
        this.addChild(menu);

        return true;
    }
});

var StartScene = cc.Scene.extend({
    onEnter:function () {
        this._super();
        var layer = new StartLayer();
        this.addChild(layer);
    }
});